﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CloudTest.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult SaveFile()
        {
            try
            {
                using (FileStream fileStream = new FileStream(@"dxss.txt", FileMode.Create, FileAccess.Write))
                {
                    using (StreamWriter writer = new StreamWriter(fileStream))
                    {
                        writer.WriteLine("Saved: {0}", DateTime.Now);
                    }
                }
                this.TempData["msg"] = "Saved!";
            }
            catch (Exception ex)
            {
                this.TempData["msg"] = "WJERR: " + ex.ToString();
            }

            return this.RedirectToAction("Index");
        }
    }
}
